<%- include ../common/header %>
<link rel="stylesheet" href="/css/exams/woDeBeiJi.css" />
<link rel="stylesheet" type="text/css" href="/css/common/dialog.css"/>
<link rel="stylesheet" href="/css/exams/cuoTiChongZuo.css" />
<script src="/js/libs/iscroll.js" type="text/javascript" charset="utf-8"></script>
<header>
	<div class="backs"><a href="/Nurse"><img src="/images/back.png" /></a></div>
	<div class="title_name">错题重做</div>
	<div id="tab_problem" data-value="2">背题模式</div>
</header>
<script>
	var myscroll,pullUpEl, pullUpOffset,pullDownEl, pullDownOffset;
	function loaded(){
		pullDownEl = document.getElementById('pullDown');
    	pullDownOffset = pullDownEl.offsetHeight;
		pullUpEl = document.getElementById('pullUp');	
		pullUpOffset = pullUpEl.offsetHeight;
		myscroll = new iScroll("wrapper",{
			scrollY:true,
			freeScroll:true,
			hScrollbar:false,
            vScrollbar:false,
            lockDirection:true,
            hScroll :false, 
            useTransition: false,
            onRefresh: function () {
				if (pullDownEl.className.match('loading')) {
	                pullDownEl.className = '';
	                pullDownEl.querySelector('.pullDownLabel').innerHTML = '下拉刷新...';
	            } else if(pullUpEl.className.match('loading')) {
					pullUpEl.className = '';
					pullUpEl.querySelector('.pullUpLabel').innerHTML = '上拉加载更多...';
				}
			},
            onScrollMove:function(){
            	if (this.y > 5 && !pullDownEl.className.match('flip')) {
	                pullDownEl.className = 'flip';
	                pullDownEl.style.display ='block';
	                pullDownEl.querySelector('.pullDownLabel').innerHTML = '松手开始更新...';
	                this.minScrollY = 0;
	            } else if (this.y < 5 && pullDownEl.className.match('flip')) {
	                pullDownEl.className = '';
	                pullDownEl.querySelector('.pullDownLabel').innerHTML = '下拉刷新...';
	                this.minScrollY = -pullDownOffset;
	            }else if(this.y < (this.maxScrollY - 5) && !pullUpEl.className.match('flip')) {
					pullUpEl.className = 'flip';
					pullUpEl.querySelector('.pullUpLabel').innerHTML = '松手开始加载...';
					this.maxScrollY = this.maxScrollY;
				} else if (this.y > (this.maxScrollY + 5) && pullUpEl.className.match('flip')) {
					pullUpEl.className = '';
					pullUpEl.querySelector('.pullUpLabel').innerHTML = '上拉加载更多...';
					this.maxScrollY = pullUpOffset;
				}
            },
            onScrollEnd: function () {
            	myscroll.refresh();
            	if (pullDownEl.className.match('flip')) {
	                pullDownEl.className = 'loading';
	                pullDownEl.querySelector('.pullDownLabel').innerHTML = '加载中...';               
	                pullDownAction();   // ajax call
	            }else if(pullUpEl.className.match('flip')) {
					pullUpEl.className = 'loading';
					pullUpEl.querySelector('.pullUpLabel').innerHTML = '加载中...';				
					pullUpAction();	// Execute custom function (ajax call?)
				}
			}
		});
	}
	window.addEventListener("DOMContentLoaded", loaded, false);
</script>
<!-----------------切换卡--------------------->
<div id="problem">
	<div class="problme_active">我的错题</div>
	<div>高频错题</div>
</div>
<div id="loadingDiv" class="loader"></div>
<div id="wrapper">
	<div id="scroller">
		<div class='noNum'>
			没有错题
		</div>
		<div id="pullDown" style="display: none;">
			<span class="pullDownIcon"></span><span class="pullDownLabel">下拉刷新...</span>
		</div>
		<ul id="list_problem">
					
		</ul>
		<ul id='list_problem1'>
					
		</ul>
		<div id="pullUp" style="display: none;">
			<span class="pullUpIcon"></span><span class="pullUpLabel">上拉加载更多...</span>
		</div>
	</div>
</div>
	<script src="/js/libs/jquery.js" type="text/javascript" charset="utf-8"></script>
	<script data-main="/js/exams/cuoTiChongZuo.js" src="/js/libs/require.js"></script>
	